/*
 * Copyright (C) 2014 Realtek Semiconductor Corp.
 * All Rights Reserved.
 *
 * This program is the proprietary software of Realtek Semiconductor
 * Corporation and/or its licensors, and only be used, duplicated,
 * modified or distributed under the authorized license from Realtek.
 *
 * ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER
 * THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
 *
 * Purpose : Definition of ME handler: Threshold data 1 (273)
 *
 * Feature : The file includes the following modules and sub-modules
 *           (1) ME handler: Threshold data 1 (273)
 */

#include "app_basic.h"


MIB_TABLE_INFO_T gMibThresholdData1TableInfo;
MIB_ATTR_INFO_T  gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_ATTR_NUM];
MIB_TABLE_THRESHOLDDATA1_T gMibThresholdData1DefRow;
MIB_TABLE_OPER_T gMibThresholdData1Oper;


GOS_ERROR_CODE ThresholdData1DrvCfg(void* pOldRow, void* pNewRow, MIB_OPERA_TYPE operationType, MIB_ATTRS_SET attrSet, UINT32 pri)
{
	OMCI_LOG(OMCI_LOG_LEVEL_DBG,"%s: process end\n", __FUNCTION__);
	return GOS_OK;
}

GOS_ERROR_CODE mibTable_init(MIB_TABLE_INDEX tableId)
{
    gMibThresholdData1TableInfo.Name = "ThresholdData1";
    gMibThresholdData1TableInfo.ShortName = "TH1";
    gMibThresholdData1TableInfo.Desc = "Threshold data 1";
    gMibThresholdData1TableInfo.ClassId = (UINT32)(OMCI_ME_CLASS_THRESHOLD_DATA_1);
    gMibThresholdData1TableInfo.InitType = (UINT32)(OMCI_ME_INIT_TYPE_OLT);
    gMibThresholdData1TableInfo.StdType = (UINT32)(OMCI_ME_TYPE_STANDARD);
    gMibThresholdData1TableInfo.ActionType = (UINT32)(OMCI_ME_ACTION_CREATE | OMCI_ME_ACTION_DELETE | OMCI_ME_ACTION_SET | OMCI_ME_ACTION_GET);
    gMibThresholdData1TableInfo.pAttributes = &(gMibThresholdData1AttrInfo[0]);

	gMibThresholdData1TableInfo.attrNum = MIB_TABLE_THRESHOLDDATA1_ATTR_NUM;
	gMibThresholdData1TableInfo.entrySize = sizeof(MIB_TABLE_THRESHOLDDATA1_T);
	gMibThresholdData1TableInfo.pDefaultRow = &gMibThresholdData1DefRow;

    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Name = "EntityId";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE1_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue1";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE2_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue2";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE3_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue3";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE4_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue4";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE5_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue5";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE6_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue6";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE7_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue7";

    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Entity ID";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE1_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 1";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE2_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 2";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE3_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 3";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE4_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 4";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE5_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 5";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE6_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 6";
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE7_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 1";

    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE1_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE2_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE3_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE4_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE5_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE6_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE7_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;

    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE1_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE2_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE3_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE4_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE5_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE6_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE7_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;

    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = TRUE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE1_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE2_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE3_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE4_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE5_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE6_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE7_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;

    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE1_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE2_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE3_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE4_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE5_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE6_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE7_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE1_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE2_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE3_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE4_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE5_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE6_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE7_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;

    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE1_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE2_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE3_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE4_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE5_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE6_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE7_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;

    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE1_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE2_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE3_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE4_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE5_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE6_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE7_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;

    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE1_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE2_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE3_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE4_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE5_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE6_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData1AttrInfo[MIB_TABLE_THRESHOLDDATA1_THRESHOLDVALUE7_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;

    memset(&(gMibThresholdData1DefRow.EntityId), 0x00, sizeof(gMibThresholdData1DefRow.EntityId));
    memset(&(gMibThresholdData1DefRow.ThresholdValue1), 0x00, sizeof(gMibThresholdData1DefRow.ThresholdValue1));
    memset(&(gMibThresholdData1DefRow.ThresholdValue2), 0x00, sizeof(gMibThresholdData1DefRow.ThresholdValue2));
    memset(&(gMibThresholdData1DefRow.ThresholdValue3), 0x00, sizeof(gMibThresholdData1DefRow.ThresholdValue3));
    memset(&(gMibThresholdData1DefRow.ThresholdValue4), 0x00, sizeof(gMibThresholdData1DefRow.ThresholdValue4));
    memset(&(gMibThresholdData1DefRow.ThresholdValue5), 0x00, sizeof(gMibThresholdData1DefRow.ThresholdValue5));
    memset(&(gMibThresholdData1DefRow.ThresholdValue6), 0x00, sizeof(gMibThresholdData1DefRow.ThresholdValue6));
    memset(&(gMibThresholdData1DefRow.ThresholdValue7), 0x00, sizeof(gMibThresholdData1DefRow.ThresholdValue7));

    memset(&gMibThresholdData1Oper, 0x0, sizeof(MIB_TABLE_OPER_T));
    gMibThresholdData1Oper.meOperDrvCfg = ThresholdData1DrvCfg;
    gMibThresholdData1Oper.meOperConnCheck = NULL;
    gMibThresholdData1Oper.meOperDump = omci_mib_oper_dump_default_handler;
	gMibThresholdData1Oper.meOperConnCfg = NULL;

	MIB_TABLE_THRESHOLDDATA1_INDEX = tableId;
    MIB_InfoRegister(tableId, &gMibThresholdData1TableInfo, &gMibThresholdData1Oper);

    return GOS_OK;
}
